t2m <- get_power(
community = "re",
lonlat = c(114.9, 4.9),
pars = "T2M",
dates = c("1981-01-01", "2023-12-31"),
temporal_api = "monthly"
)Climate Analysis for Brunei
1 Research Question
Climate change has been prevalent worldwide, causing adverse effects felt by all. It would be interesting to explore:
- How has Brunei’s temperature evolved over time, and is this consistent with global temperature trends?
- Using PCA to interpret these trends?
2 Data Collection and Preprocessing
Dataset is sourced from NASA POWER API accessed using nasapower package in R. Available data ranged from year 1981 to 2023. Code as follow:
3 Exploratory Data Analysis (EDA)
viz <-
ggplot(t2m, aes(x = DATE, y = value)) +
geom_line(col = "blue") +
labs(
title = "Brunei BSB Monthly Temperature",
x = "Date",
y = "Temperature (°C)"
) +
theme_minimal()
ggplotly(viz)Most of extreme temperature falls in the month of May. Does this mean mid year is the hottest in Brunei? Does these period of extreme temperature correlate with Elnino effect?
Applying linear regression, it is suggested that temperature increase by 0.018°C. Despite seeming negligible, this correspond to 0.9°C over 50 years!
lm_temp <- lm(value ~ YEAR, data = t2m)
summary(lm_temp)
Call:
lm(formula = value ~ YEAR, data = t2m)
Residuals:
Min 1Q Median 3Q Max
-1.58327 -0.34923 0.01707 0.39578 2.00782
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -8.987713 3.999351 -2.247 0.025 *
YEAR 0.018083 0.001998 9.052 <2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.5631 on 514 degrees of freedom
Multiple R-squared: 0.1375, Adjusted R-squared: 0.1358
F-statistic: 81.94 on 1 and 514 DF, p-value: < 2.2e-16